// pages/mine/teamDetails/index.js
const app = getApp(),
    globalData = app.globalData,
    api = require("../../../api/index"),
    testdata = require("testdata.js"),
    utils = require('../../../utils/util');
Page({

  /**
   * 页面的初始数据
   */
  data: {
    canpIcon: globalData.pictureRouting + 'touxiang_icon_wodetiuand.png',
    activeNames: ['1'],
    typeName:wx.getStorageSync('agentInfo').MemberGradeName,
    ItemUserInfo:""

  },
  onChange(event) {
    console.log(event)
    this.setData({
      activeNames: event.detail,
    });
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    this.setData({agentInfo: JSON.parse(options.agentInfo)})
    this.setData({userInfo: JSON.parse(options.userInfo)})
    console.log(999,this.data.userInfo)
    this.getRebateDetail(options.userid)
  },

  async getRebateDetail(userId){
    let res = await api.member.getRebateDetail({user_id: userId})
    let data = res.data.ResData
    this.setData({
        detailArr: data.Items,
        ItemUserInfo:data.UserInfo
    })
    console.log(this.data.detailArr,this.data.ItemUserInfo);
    // this.setData({
    //     detailArr: testdata.data.ResData.Items
    // })
  },

  tixian(){
    wx.navigateTo({
      url: '/pages/mine/withdrawalp/withdrawalp',
    })
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})